package com.game.logic.channel;

import java.util.Collection;

import com.game.framework.message.event.IGameMessage;
import com.game.framework.message.stream.ServiceMessageHeader;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class GameServerContext {

	private ServerChannelContext serverChannelContext;

	private ServiceMessageHeader header;


	public GameServerContext(ServiceMessageHeader header, ServerChannelContext serverChannelContext) {
		this.serverChannelContext = serverChannelContext;
		this.header = header;
	}

	public ServiceMessageHeader getHeader() {
		return header;
	}

	public long getUserId() {
		return this.header.getUserId();
	}
	public String getAccount() {
		return this.header.getAttr().getAccount();
	}

	public ServerChannelContext getServerChannelContext() {
		return serverChannelContext;
	}

	public void setServerChannelContext(ServerChannelContext serverChannelContext) {
		this.serverChannelContext = serverChannelContext;
	}

	public void sendToGateway(IGameMessage gameMessage) {
		serverChannelContext.sendToGateway(gameMessage);
	}
	public void broadcastToGateway(IGameMessage gameMessage,Collection<Long> userIds) {
        serverChannelContext.broadcastToGateway(gameMessage, userIds);
	}
}
